home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / business / misc / fwmacros2 / goto_main < prev    next >
Text File  |  1994-10-05  |  4KB  |  122 lines

  1. /* ======================================== */
  2. /*  FINAL WRITER AREXX MACRO                */
  3. /*    by Nigel S. Domaingue, 28/1/95        */
  4. /*                                          */
  5. /*  Script to goto Main Section.            */
  6. /*  $Ver:  Goto_Main 1.0 (28/1/95)          */
  7. /* ======================================== */
  8.  
  9. /* Allows user to move to (almost) any Main section. */
  10. /* Only use if there are less than 6 sections.       */
  11.  
  12. /* This script is more complicated than the */
  13. /* other similar scripts as there can be    */
  14. /* more than one main section.              */
  15.  
  16. Options Results
  17.  
  18. toc = 'Table of Contents'
  19. tp = 'Title Page'
  20. ind = 'Index'
  21. bib = 'Bibliography'
  22. out = 'Outline'
  23.  
  24. GetSectionList ","
  25. listing = Result
  26.  
  27. /* The following is standard ARexx and  */
  28. /* is not Final Writer specific.        */
  29.  
  30. /* Set up two stems (i.e. arrays) */
  31. x. = sections
  32. main. = Unused
  33. m = 0
  34.  
  35. /* Split 'listing' into component parts */
  36. /* and put those into the x. stem.      */
  37. PARSE VAR listing x.1 ',' x.2 ',' x.3 ',' x.4 ',' x.5 ',' x.6 ',' x.7 ',' x.8 ',' x.9 ',' x.10
  38. do i = 1 to 10
  39.       IF ( LENGTH(x.i) = 0 ) THEN
  40.       Do
  41.          n = i-1
  42.          i = 10
  43.       end
  44. end
  45.  
  46. /*  The MAIN sections are isolated by elimination,   */
  47. /* since they will likely have unique names whilst   */
  48. /* contents and title pages are often unchanged.     */
  49. /*  If the names of other sections are changed, then */
  50. /* they will be treated as MAIN sections.            */
  51.  
  52. Do i = 1 to n
  53. a = x.i
  54. IF ( a = tp ) THEN NOP
  55.    ELSE IF ( a = out ) THEN NOP
  56.       ELSE IF ( a = toc ) THEN NOP
  57.          ELSE IF ( a = bib ) THEN NOP
  58.             ELSE IF ( a = ind ) THEN NOP
  59.                ELSE DO
  60.                   m = m + 1
  61.                   main.m = '"'x.i'"'
  62.                END
  63. END
  64.  
  65. /* The user gets a choice iff there is more than  */
  66. /* one section, via the ShowMessage requester.    */
  67. /*  This can only handle 3 options at a time, so  */
  68. /* if there are more than 5 sections it is pretty */
  69. /* much useless and other ways are better.        */
  70. If ( m = 1 ) THEN
  71.    GoToSection main.m
  72. If ( m = 2 ) THEN
  73.    Do
  74.       ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.1 main.2 '""'
  75.       jump = Result
  76.       If ( jump = 1 ) Then GoToSection main.1
  77.       If ( jump = 2 ) Then GoToSection main.2
  78.    end
  79.  
  80. If ( m = 3 ) THEN
  81.    Do
  82.       ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.1 main.2 main.3
  83.       jump = Result
  84.       If ( jump = 1 ) Then GoToSection main.1
  85.       If ( jump = 2 ) Then GoToSection main.2
  86.       If ( jump = 3 ) Then GoToSection main.3
  87.    end
  88. If ( m = 4 ) THEN
  89.    Do
  90.       ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.1 main.2 '"Next Menu"'
  91.       jump = Result
  92.       If ( jump = 1 ) Then GoToSection main.1
  93.       If ( jump = 2 ) Then GoToSection main.2
  94.       If ( jump = 3 ) Then
  95.          Do
  96.             ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.3 main.4 '""'
  97.             jump = Result
  98.             If ( jump = 1 ) Then GoToSection main.3
  99.             If ( jump = 2 ) Then GoToSection main.4
  100.          end
  101.    end
  102. If ( m = 5 ) THEN
  103.    Do
  104.       ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.1 main.2 '"Next Menu"'
  105.       jump = Result
  106.       If ( jump = 1 ) Then GoToSection main.1
  107.       If ( jump = 2 ) Then GoToSection main.2
  108.       If ( jump = 3 ) Then
  109.          Do
  110.             ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.3 main.4 main.5
  111.             jump = Result
  112.             If ( jump = 1 ) Then GoToSection main.3
  113.             If ( jump = 2 ) Then GoToSection main.4
  114.             If ( jump = 3 ) Then GoToSection main.5
  115.          end
  116.    end
  117. If ( m > 5 ) THEN
  118.    Do
  119.       ShowMessage 1 0 '"There are more than five Main sections." "I suggest you use the G button instead." "" "Silly me" "" ""'
  120.    end
  121.  
  122.